﻿using WebChatApi.Common.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebChatApi.Common
{
    /// <summary>
    /// Generic class for service response. 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ServiceCollectionResponse<T> : List<T>, IServiceResponse
    {
        /// <summary>
        /// Gets a value indicating whether this instance is success. <c>Set</c> operation is for serialization compatibility only.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is success; otherwise, <c>false</c>.
        /// </value>
        public bool IsSuccess
        {
            get
            {
                return this.ExceptionInfo != null;
            }
            set
            {
                //Do nothing
            }
        }

        /// <summary>
        /// Gets or sets the exception info.
        /// </summary>
        /// <value>
        /// The exception info.
        /// </value>
        public ExceptionInfo ExceptionInfo
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceCollectionResponse{T}"/> class.
        /// </summary>
        public ServiceCollectionResponse()
            : base()
        {
        }
    }
}
